﻿using System;

class Program
{
    static void Main(string[] args)
    {
        // 整型list
        GenericList<int> intList = new GenericList<int>();
        for (int x = 0; x < 10; x++)
        {
            intList.Add(x);
        }
        intList.ForEach(item => Console.WriteLine(item));  // 打印链表元素
        int sum = 0;
        int max = intList.Head.Data;
        int min = intList.Head.Data;

        // 求和、最大值、最小值
        intList.ForEach(item =>
        {
            sum += item;
            if (item > max) max = item;
            if (item < min) min = item;
        });

        Console.WriteLine("Sum: " + sum);
        Console.WriteLine("Max: " + max);
        Console.WriteLine("Min: " + min);

        // 字符串型list
        GenericList<string> strList = new GenericList<string>();
        for (int x = 0; x < 10; x++)
        {
            strList.Add("str" + x);
        }
        strList.ForEach(item => Console.WriteLine(item));  // 打印链表元素
    }
}